﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OrderManager.Orders
{
    abstract class OrderProcessorBase
    {
        public void Process(Order order)
        {
            if (this.ProcessImpl(order))
            {
                Broadcast.OrderChangedMessage message = new Broadcast.OrderChangedMessage();
                message.Address = order.Address;
                message.Flag = order.Flag;
                message.OrderID = order.ID;
                message.SellerComment = order.SellerComment;
                message.ShopInfo = order.ShopInfo;
                message.Time = DateTime.Now;
                Broadcast.MessageCenter.Instance.SendMessage(message);
            }
        }

        protected abstract bool ProcessImpl(Order order);
    }
}
